export enum ThemeElement {
  // 平台
  Search = 'search', // 搜索
  Blog = 'blog', // 博客
  TieBar = 'tiebar', // 贴吧
  // 组件
  Title = 'title', // 标题
  Icon = 'icon', // 图标
  Tag = 'tag', // 标签
  Select = 'select', // 下拉框
  Text = 'text', // 文本框
  Textarea = 'textarea', // 文本域
  Badge = 'badge', // 徽章
  Button = 'button', // 按钮
  Input = 'input', // 输入框
  Card = 'card', // 卡片
  Link = 'link', // 链接
  Tab = 'tab', // 选项卡
  Navbar = 'navbar', // 导航栏
  Em = 'em', // 强调
  PageBar = 'page-bar', // 分页条
  Answer = 'answer', // 回答
}

export enum ThemeStatus {
  Success = 'success',
  Warning = 'warning',
  Error = 'error',
  Danger = 'danger',
  Info = 'info',
  Orange = 'orange',
  Purple = 'purple',
}

export enum ThemeProperty {
  Bg = 'bg', // 背景
  Text = 'text', // 文字
  Shadow = 'shadow', // 阴影
  Border = 'border', // 边框
  Hover = 'hover', // 悬停
  Active = 'active', // 激活
  Disabled = 'disabled', // 禁用
  Checked = 'checked', // 选中
  Focus = 'focus', // 聚焦
}

export enum ThemeState {
  Normal = 'normal', // 正常
  Hover = 'hover', // 悬停
  Active = 'active', // 激活
  Disabled = 'disabled', // 禁用
  Checked = 'checked', // 选中
  Focus = 'focus', // 聚焦
  Visited = 'visited', // 已访问
}

export interface ThemeVarConfig {
  status?: ThemeStatus // 状态
  element?: ThemeElement // 元素
  subElement?: string // 子元素
  property?: ThemeProperty // 属性
  state?: ThemeState // 状态
  modifier?: string // 前置修饰符
  postModifier?: string // 后置修饰符
}

export interface ThemeVarNameOptions {
  withVar?: boolean
  important?: boolean
}

export type TextThemeVarName = 'text' | 'textHover' | 'textVisited' | 'textActive' | 'textNeutral'
export type TextThemeVarConfig = Record<TextThemeVarName, string>

export interface DefaultThemeVarConfig {
  base: {
    primary: string
  }
  style: {
    margin: string
    padding: string
    borderRadius: string
  }
  text: {
    base: string
    primary: string
    secondary: string
    hint: string
    neutral: string
  }
  background: {
    base: string
    surface: string
    overlay: string
    preview: string
    highlight: string
    fixed: string
    list: string
    left: string
    right: string
  }
  border: {
    colorPrimary: string
    colorNeutral: string
    colorActive: string
  }
  shadow: {
    sm: string
    hover: string
  }
}

export interface ThemeVarIconConfig {
  default: string
  hover: string
  active: string
  disabled: string
}

export interface TitleThemeVarConfig {
  default: {
    primary: string
  }
}

export interface MessageThemeVarConfig {
  success: {
    textPrimary: string
    textSecondary: string
  }
  warning: {
    textPrimary: string
    textSecondary: string
  }
  error: {
    textPrimary: string
    textSecondary: string
  }
  danger: {
    textPrimary: string
    textSecondary: string
  }
  info: {
    textPrimary: string
    textSecondary: string
  }
  orange: {
    textPrimary: string
    textSecondary: string
  }
  purple: {
    textPrimary: string
    textSecondary: string
  }
}

export type EmThemeVarConfig = Partial<Record<TextThemeVarName, string>>

export interface PageBarThemeVarConfig {
  default: {
    border: string
    borderRadius: string
    fontSize: string
    height: string
    gap: string
  }
  button: {
    padding: string
  }
  currentPage: {
    bg: string
    text: string
  }
  otherPage: {
    bg: string
    bgHover: string
    text: string
    textHover: string
  }
}

export interface AnswerThemeVarConfig {
  default: {
    background: string
  }
  switch: {
    mask: {
      text: string
      background: string
    }
  }
  loading: {
    background: string
  }
}

export interface TabThemeVarConfig extends Partial<TextThemeVarConfig> {
  bgFocus: string
  borderActive: string
  borderBottom: string
  fontSize: string
}

export interface SearchThemeVarConfig {
  default: {
    text: string
    textBase: string
    textPrimary: string
    textNeutral: string
    background: string
    fontSize: string
  }
  inputBox: {
    border: string
    borderTransparent: string
  }
  header: {
    background: string
  }
  history: {
    text: string
  }
  suggestions: {
    text: string
    fontWeight: string
  }
  resultItem: {
    background: string
    backgroundOfficial: string
    backgroundPopular: string
    shadow: string
    paddingStandard: string
    // 带操作区域的内边距（paddingWithAction）
    padding: string
    borderRadius: string
    gap: string
    titleFontSize: string
    noItemTip: string
  }
}

export interface BlogThemeVarConfig {}

export interface TieBarThemeVarConfig {
  default: {
    text: string
    textBase: string
    textPrimary: string
    background: string
    borderRadius: string
    gap: string
    padding: string
  }
  header: {
    background: string
  }
  answer: {
    background: string
  }
  comment: {
    background: string
  }
}
